package com.example.rocketmq.springboot_test;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class SpringBootProducer {

    @Resource
    private RocketMQTemplate rocketMQTemplate;

    @Value("${test.mq.topic}")
    private String testTopic;

    public void sendMessage(String msg) {
        rocketMQTemplate.convertAndSend(testTopic, msg);
    }
}
